#!/bin/bash

#------------------------------------------------------------------------------
#Filename:	74770-uninstallkernel.sh
#Version:	1.1
#Date:		2013/07/11
#Author:	yuanhui.shi
#Email:		yuanhui.shi@cs2c.com.cn
#Summary:	02.01系统核心功能-05内核支持-01内核-02卸载内核
#Notes:		卸载内核不能重启，如果重启后，自动化测试无法完成，必须手动安装内核
#Copyright:	China Standard Software Co.,Ltd.
#History:
#		Version 1.0,2013/07/15
#		-The first one
#		Version 1.1,2013/09/03
#		-Modify the script to satisfy the shell standard
#------------------------------------------------------------------------------


PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

source ../../lib/Echo.sh

#rpm -e kernel --nodeps &> /dev/null
if [ -z `ls /boot |grep vmlinuz` -a -z `ls /boot |grep initramfs` ] 
then
    {
      EchoInfo "卸载内核后，boot目录内kernel以及ramdisk文件已经删除" 
      if [ -z "`cat /boot/grub/menu.lst |grep "NeoKylin Linux Advanced Server"`" ] 
      then 
         EchoResult "内核卸载成功" 
      else
         EchoResult "内核卸载完成后，引导文件没有被删除,请查看系统是不是只有一个系统，所以无法删除引导文件";exit 1
      fi
     }
else
    EchoResult "卸载内核后，boot目录内kernel以及ramdisk文件没有被删除";exit 1
fi

EchoInfo "74770-uninstallkernel.sh执行完毕"
